function snifferMovieList(url) {
    try {
        var json = [];
        var movieList = document.getElementsByClassName("myui-vodlist__thumb lazyload");
        for(var i = 0; i < movieList.length; i++) {
            json.push({
                score: movieList[i].innerText,
                name: movieList[i].getAttribute("title"),
                refer: movieList[i].href,
                imageUrl: movieList[i].getAttribute("data-original"),
                host: location.host
            });
        }
        const result = {
            location: document.location,
            dataList: json
        };
        const params = JSON.stringify(result);
        console.log(params);
        window.JsBridge.callNative("onMovieListLoaded", params);
    } catch (error) {
        console.log(error);
    }
}

function snifferPlayList() {
    try {
        var json = [];
        var playlist = document.getElementById("playlist1");
        var msg = playlist.innerHTML;
        var alist = playlist.getElementsByTagName("a");
        for(var i = 0; i < alist.length; i++) {
            json.push({
                title: alist[i].innerText,
                refer: alist[i].href
            });
        }
        const result = {
            location: document.location,
            dataList: json
        };
        const params = JSON.stringify(result);
//      console.log(params);
        window.JsBridge.callNative("onPlayListLoaded", params);
    } catch (error) {
        console.log(error);
    }
}

function snifferPlayInfo() {
    try {
        player_data.title = document.title;
        const result = JSON.stringify(player_data);
//      console.log(result);
        window.JsBridge.callNative("onPlayInfoLoaded", result);
    } catch (error) {
        console.log(error);
    }
}

function snifferSearchList() {
    try {
        var json = [];
        var elements = document.getElementById("searchList").children;
        var len = elements.length;
        for (var i = 0; i < len - 1; i++) {
            var element = elements[i];
            var aTag = element.children[0].children[0];
            var pTagList = element.children[1].getElementsByTagName("p");
            json.push({
                score: aTag.innerText,
                name: aTag.getAttribute("title"),
                refer: aTag.href,
                imageUrl: aTag.getAttribute("data-original"),
                direct: pTagList[0].innerText,
                actors: pTagList[1].innerText,
                rawData: pTagList[2].innerHTML,
                host: location.host
            });
        }
        const result = JSON.stringify(json);
        window.JsBridge.callNative("onSearchListLoaded", result);
    } catch (error) {
        console.log("snifferSearchList:" + error);
    }
}